package com.briup.oagg.facade.web.controller.dataset;

import com.briup.oagg.facade.web.vm.page.Page;
import com.briup.framework.utils.web.Response;
import com.briup.oagg.facade.service.dateset.IIndicatorService;
import com.briup.oagg.facade.web.vm.dataset.IndicatorVM;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 指标信息业务前端控制器
 *
 * @author briup
 */
@Api(tags = "1.7.指标管理服务")
@RestController
@RequestMapping("/indicator")
public class IndicatorsController {

    @Autowired
    private IIndicatorService service;

    @ApiOperation(value = "分页多条件查询数据集包含的指标名", notes = "根据数据集id分页查询数据集中对应的指标信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "当前页码",defaultValue = "1",required = true,dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "每页大小",defaultValue = "5",required = true,dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "datasetId", value = "数据集编号"),
    })
    @GetMapping("/page")
    public Response<Page<IndicatorVM>> getIndicatorsByPage(String datasetId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
        return Response.success(service.findByPage(datasetId,pageNum,pageSize));
    }
}
